import java.util.*;

/**
 * @Classname: text1
 * @Author: bromide
 * @CreateTime: 2022/5/7--14:29
 * @Version: V1.0
 * @Description:
 * 输入一个字符,对字符串进行压缩,如:字符串"abcdabcd"由于无连续重复字符,压缩后的字符串还是"abcdabcd"
 * 字符串"xxxrryyyyyyz"压缩后就称为"3x2r6yz".
 */
public class text1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        /**
         * 方法1
         */
        StringBuilder builder = new StringBuilder();
        int num = 1;
        for (int i = 0; i < line.length()-1; i++) { //到倒数第二个字符就结束循环
            char cur = line.charAt(i);
            char pre = line.charAt(i+1);
            if (cur==pre){
                num++;
            }
            if (cur!=pre || i==line.length()-2){//当连续字符结束,或者执行到最后一个的时候,写入到builder中;
                if (num>1){
                    builder.append(num);
                }
                builder.append(cur);
                num=1;
                if (i==line.length()-2&&pre!=cur){
                    builder.append(pre);
                }
            }
        }
        System.out.println(builder.toString());

        /**
         * 方法2
         *
         * 存在的问题   输入:aabbccaa  输出:2a2b2c
         */
        /*Map<Character,Integer> map = new HashMap<>();
        map.put(line.charAt(0),1);
        for (int i = 1; i < line.length(); i++) {
            Character c = line.charAt(i);
            if (map.containsKey(c)){
                map.put(c,map.get(c)+1);
            }else {
                map.put(c,1);
            }
        }

        StringBuilder builder = new StringBuilder();
        map.forEach((k,v)->{
           if (v!=1){
               builder.append(v);
           }
           builder.append(k);
        });
        for (Map.Entry entry:map.entrySet()){
            if ((int)entry.getValue()!=1){
                builder.append(entry.getValue());
            }
            builder.append(entry.getKey());
        }
        System.out.println(map);
        System.out.println(builder.toString());*/
    }
}
